/**
 * Copyright (C) 2013 Christos Koufogiannakis
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 *     
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.easychart.demo;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.app.ListActivity;
import android.content.Intent;
import android.widget.ArrayAdapter;
import android.widget.ListView;
 
/**
 * Main Menu
 */
public class MainMenu extends ListActivity {
 
	private static final String[] CHART_TYPE = new String[] { "Bar chart example", "Line chart example",
		"Multi-line chart example","Point chart example", "Box plot example", "Pie chart example", 
		"Dynamic Bar chart", "Dynamic Line chart", "Dynamic Pie chart", 
		"Two charts"};
 
	private static final String DEMO_PACKAGE = "com.easychart.demo";
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
 
		setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, CHART_TYPE));
 
		ListView listView = getListView();
		listView.setTextFilterEnabled(true);
		listView.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
				Intent intent = null;
				
				switch(position) {
				case 0:
			        intent = new Intent(DEMO_PACKAGE + ".EXAMPLEBAR"); 
					break;
				case 1:
			        intent = new Intent(DEMO_PACKAGE + ".EXAMPLELINE"); 
					break;
				case 2:
			        intent = new Intent(DEMO_PACKAGE + ".EXAMPLEMULTILINE"); 
					break;
				case 3:
			        intent = new Intent(DEMO_PACKAGE + ".EXAMPLEPOINT"); 
					break;		
				case 4:
			        intent = new Intent(DEMO_PACKAGE + ".EXAMPLEBOX"); 
					break;		
				case 5:
			        intent = new Intent(DEMO_PACKAGE + ".EXAMPLEPIE"); 
					break;	
				case 6:
			        intent = new Intent(DEMO_PACKAGE + ".EXAMPLEBARDYNAMIC"); 
					break;
				case 7:
			        intent = new Intent(DEMO_PACKAGE + ".EXAMPLELINEDYNAMIC"); 
					break;
				case 8:
			        intent = new Intent(DEMO_PACKAGE + ".EXAMPLEPIEDYNAMIC"); 
					break;
				case 9:
			        intent = new Intent(DEMO_PACKAGE + ".EXAMPLETWOCHARTS"); 
					break;
				}
				
		        startActivity(intent);
			}
		});
	}
}

